package org.example.leetCode;

/**
 * @author Administrator
 */
public class MySqrt {
    public int mySqrt(int x) {
        int min = 0;
        int max = x;
        while (min < max) {
            int m = min + (max - min) / 2;
            if (m > x / m) {
                max = m;
            } else {
                min = m;
            }
        }
        return min;
    }
}
